#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define LL long long
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;

#define MS 100010
char s[MS];
int L, H;
int n;

bool load()
{
	cin >> L >> H;
	if (L + H == 0) return 0;
	nextLine();
	gets(s);
	n = strlen(s);
	return 1;
}

int cnt[MS], beg[MS], a[MS], a2[MS], c[MS], c2[MS];
int lcp[MS], b[MS];

void suffix_array()
{
	s[n++] = 'a' - 1;
	memset(cnt, 0, sizeof(int) * 27);
	for (int i = 0; i < n; i++)
		cnt[s[i] - 'a' + 1]++;
	beg[0] = 0;
	for (int i = 1; i < 27; i++)
		beg[i] = beg[i - 1] + cnt[i - 1];
	for (int i = 0; i < n; i++)
		a[beg[s[i] - 'a' + 1]++] = i;
	c[a[0]] = 0;
	for (int i = 1; i < n; i++)
	{
    	c[a[i]] = c[a[i - 1]];
    	if (s[a[i]] != s[a[i - 1]])
    		c[a[i]]++;
    }
    for (int l = 1; l <= n && c[a[n - 1]] < n - 1; l <<= 1)
    {
    	for (int i = 0; i <= c[a[n - 1]]; i++)
    		cnt[i] = 0;
    	for (int i = 0; i < n; i++)
    		cnt[c[a[i]]]++;
    	beg[0] = 0;
    	for (int i = 1; i <= c[a[n - 1]]; i++)
    		beg[i] = beg[i - 1] + cnt[i - 1];
    	for (int i = 0; i < n; i++)
    	{
    		int j = a[i] - l;
    		if (j < 0) j += n;
    		a2[beg[c[j]]++] = j;
    	}
    	c2[a2[0]] = 0;
    	for (int i = 1; i < n; i++)
    	{
    		c2[a2[i]] = c2[a2[i - 1]];
    		int j = a2[i - 1] + l;
    		int k = a2[i] + l;
    		if (j >= n) j -= n;
    		if (k >= n) k -= n;
    		if (c[a2[i]] != c[a2[i - 1]] || c[j] != c[k])
    			c2[a2[i]]++;
    	}
    	for (int i = 0; i < n; i++)
    	{
    		c[i] = c2[i];
    		a[i] = a2[i];
    	}
    }
	for (int i = 0; i + 1 < n; i++)
		a[i] = a[i + 1];
	n--;
}

void kasai()
{
	for (int i = 0; i < n; i++)
		b[a[i]] = i;
	for (int i = 0, k = 0; i < n; i++)
	{
		if (b[i] == n - 1)
		{
			k = 0;
			lcp[b[i]] = 0;
			continue;
		}
		while (i + k < n && a[b[i] + 1] + k < n && s[i + k] == s[a[b[i] + 1] + k]) k++;
		lcp[b[i]] = k;
		k = max(k - 1, 0);
	}
}


void solve()
{
	suffix_array();
	kasai();
/*	cout << s << "\n";
	for (int i = 0; i < n; i++)
		cout << a[i] << " ";
	cout << "\n";
	for (int i = 0; i < n; i++)
		cout << lcp[i] << " ";
	cout << "\n"; 
*/	int occurence = 0;
	int cur_len = n - a[0];
	int max_occurence = 0;
	int max_len = -1;
	for (int i = 0; i < n; i++)
	{
		occurence++;
		if (lcp[i] < L)
		{
			cur_len = min(cur_len, H);
			if (occurence > max_occurence 
			|| occurence == max_occurence && cur_len > max_len)
			{
				max_occurence = occurence;
				max_len = cur_len;
			}
			cur_len = n - a[i + 1];
			occurence = 0;
		}
		else
			cur_len = min(lcp[i], cur_len);
	}
	cout << max_occurence << " " << max_len << "\n";
}

#define file "repeated_string"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file".out", "wt", stdout);
	#endif
	while (load()) solve();
	return 0;
}
